﻿// ******************************************************************
// * Copyright(c)  Steven Lu
// * Description   : Entity_QC_IPQC_ORDER_ITEM
// * CreateDate    : 2012/4/21 21:08:05
// * Creater       : CodeSmith
// * LastChangeDate: 2012/4/21 21:08:05
// * LastChanger   : 2012/4/21 21:08:05
// * Version Info  : 1.0 For ESOL
// ******************************************************************

using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Suzsoft.Smart.Data;
using ESOL.Common.Entity;

namespace ESOL.Business.Chk
{
    /// <summary>
    /// QcIpqcOrderItem
    /// </summary>
    public partial class QcIpqcOrderItemBs
    {
        #region GetByID
        /// <summary>
        /// Get Entity
        /// </summary>
        /// <param name="objQcIpqcOrderItemEntity">Entity</param>
        /// <returns>Entity</returns>
        public static QcIpqcOrderItemEntity GetQcIpqcOrderItem(QcIpqcOrderItemEntity objQcIpqcOrderItemEntity)
        {
            return DataAccess.SelectSingle<QcIpqcOrderItemEntity>(objQcIpqcOrderItemEntity);
        }
        #endregion


        #region Insert
        /// <summary>
        /// Insert Data
        /// </summary>
        /// <param name="objQcIpqcOrderItemEntity">Entity</param>
        /// <returns>true Insert Succeed; false Insert Fail</returns>
        public static bool InsertQcIpqcOrderItem(QcIpqcOrderItemEntity objQcIpqcOrderItemEntity)
        {
            return DataAccess.Insert(objQcIpqcOrderItemEntity);
        }

        public static bool InsertQcIpqcOrderItem(List<QcIpqcOrderItemEntity> objQcIpqcOrderItemEntityList)
        {
            return DataAccess.Insert(objQcIpqcOrderItemEntityList);
        }
        #endregion


        #region Update
        /// <summary>
        /// Update Data
        /// </summary>
        /// <param name="objQcIpqcOrderItemEntity">Entity</param>
        /// <returns>true Update Succeed; false Update Fail</returns>
        public static bool UpdateQcIpqcOrderItem(QcIpqcOrderItemEntity objQcIpqcOrderItemEntity)
        {
            return DataAccess.Update(objQcIpqcOrderItemEntity);
        }

        public static bool UpdateQcIpqcOrderItem(List<QcIpqcOrderItemEntity> objQcIpqcOrderItemEntityList)
        {
            return DataAccess.Update<QcIpqcOrderItemEntity>(objQcIpqcOrderItemEntityList);
        }
        #endregion


        #region Delete
        /// <summary>
        /// Delete Data
        /// </summary>
        /// <param name="objQcIpqcOrderItemEntity">Entity</param>
        /// <returns>true Delete Succeed; false Delete Fail</returns>
        public static bool DeleteQcIpqcOrderItem(QcIpqcOrderItemEntity objQcIpqcOrderItemEntity)
        {
            return DataAccess.Delete(objQcIpqcOrderItemEntity);
        }

        public static bool DeleteQcIpqcOrderItem(List<QcIpqcOrderItemEntity> objQcIpqcOrderItemEntityList)
        {
            return DataAccess.Delete<QcIpqcOrderItemEntity>(objQcIpqcOrderItemEntityList);
        }
        #endregion


        #region GetAll
        /// <summary>
        /// Get All Data
        /// </summary>
        /// <returns>Back All Data<returns>
        public static DataSet GetQcIpqcOrderItemAll()
        {
            return DataAccess.SelectAllDataSet<QcIpqcOrderItemEntity>();
        }
        /// <summary>
        /// Get All Data List
        /// </summary>
        /// <returns>Back All Data List<returns>
        public static List<QcIpqcOrderItemEntity> GetQcIpqcOrderItemAllList()
        {
            return DataAccess.SelectAll<QcIpqcOrderItemEntity>();
        }
        #endregion

        #region Functions
        public static DataTable GetDtAllByCondition(string sCondition)
        {
            string sql = @"select * from QC_IPQC_ORDER_ITEM qioi where 1=1 ";
            if (string.IsNullOrEmpty(sCondition) == false)
            {
                sql += sCondition;
            }
            return DataAccess.SelectDataSet(sql).Tables[0];
        }

        /// <summary>
        /// 查询质检单，根据工令单和过站工序
        /// </summary>
        /// <param name="sWorkingOrderID"></param>
        /// <param name="sProductTechnicID"></param>
        /// <returns></returns>
        public static DataTable GetDtAllByWorkingOrderID(string sWorkingOrderID, string sProductTechnicID)
        {
            string sql = @"select * from QC_IPQC_ORDER qio
where qio.PROD_PLAN_ORDER_ITEM_ID='"+sWorkingOrderID+"' ";
            sql += "and qio.PRODUCT_TECHNIC_ID='" + sProductTechnicID + "' ";
            return DataAccess.SelectDataSet(sql).Tables[0];
        }
        #endregion
    }


}

